package com.jeeplus.cms.support.comparator;

import com.jeeplus.core.persistence.TreeEntity;

import java.util.Comparator;

/**
 * 树节点排序
 *
 * @author Sawyer
 * @date 2020-11-23
 */
public class TreeNodeComparator<T extends TreeEntity<T>> implements Comparator<T> {
    @Override
    public int compare(T o1, T o2) {
        if (null != o1.getSort() && null != o2.getSort()) {
            return o1.getSort().compareTo(o2.getSort());
        }
        return 0;
    }
}
